begin
  # In case you use Gosu via RubyGems.
  require 'rubygems'
rescue LoadError
  # In case you don't.
end
$:.unshift File.dirname('media')
require 'gosu'
require 'game'
require 'frontend'
require 'background'
require 'player'
require 'projectile'
require 'drawhit'
require 'enemy'
require 'images'
require 'tiles'
require 'sounds'
require 'particle'
require 'wave'
require 'sdl'
require 'title'


SDL::init(SDL::INIT_AUDIO)
SDL::Mixer.open(22050, SDL::Mixer::DEFAULT_FORMAT, 2, 512)
SDL::Mixer::allocateChannels(100)

class GameWindow < Gosu::Window
  def initialize()
    fullscreen = false
    fullscreen = true if(ARGV[0] == '--fullscreen')
    super(640,480, fullscreen)
    self.caption = "Aero"
  end
  
  def button_down(id)
    $game.button_down(id)
  end
  
  def update()
    $game.update
  end
  
  def draw()
    $game.draw
  end
end

# initialize game globals
$screen = GameWindow.new
$game = Title.new

# and off we go.
$screen.show
